package com.cloudbroker.openapi.manage.controller;

import com.cloudbroker.bcs.common.entity.HSBCPSBackVO;
import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.dav.bizapi.service.base.vo.HSBCPSVO;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.common.back.CommonReplyList;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.common.vo.CommonReplyIdForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.common.vo.CommonReplySaveForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.back.SelfViewpointBack;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.vo.SelfViewpointByIdForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.viewpoint.result.*;
import com.cloudbroker.bcs.platform.dav.bizapi.service.viewpoint.vo.*;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.business.CommonT2BizService;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.viewpoint.BrokerT2BizService;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.viewpoint.ViewPointT2BizService;
import com.cloudbroker.bcs.platform.dav.common.ext.annotation.SaveLog;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import static com.cloudbroker.bcs.platform.dav.common.util.RequestUtil.getSingleParameterMapForBody;

@Controller
public class BrokerController {
    
    @Resource
    private BrokerT2BizService brokerT2;
    @Resource
    private ViewPointT2BizService viewpointT2;
    @Resource
    private CommonT2BizService commonT2;
    
    /**
     * 自媒体列表
     * @param request
     * @param jsonpcallback
     * @return
     */
    @ResponseBody
    @RequestMapping("/func_self_media_list_by_dav")
    @SaveLog(remark = "自媒体列表")
    public SelfMediaDavList funcSelfMediaList(HttpServletRequest request, String jsonpcallback) {
        SelfMediaListForm form = getSingleParameterMapForBody(request, SelfMediaListForm.class);
        return VOUtil.setJsonpResult(brokerT2.funcSelfMediaList(form), jsonpcallback);
    }

    @ResponseBody
    @RequestMapping("/func_self_viewpoint_by_id")
    @SaveLog(remark = "获取单个自媒体观点的详情")
    public SelfViewpointBack funcSelfViewpointById(HttpServletRequest request, String jsonpcallback) {
        SelfViewpointByIdForm form = getSingleParameterMapForBody(request, SelfViewpointByIdForm.class);
        return VOUtil.setJsonpResult(viewpointT2.funcSelfViewpointById(form), jsonpcallback);
    }
    
    /**
     * 大V观点列表
     * */
    @ResponseBody
    @RequestMapping("/func_viewpoint_list_by_dav")
    @SaveLog(remark = "大V观点列表")
    public ViewpointDavList brokerViewpointList(HttpServletRequest request, String jsonpcallback) {
        ViewpointListForm form = getSingleParameterMapForBody(request, ViewpointListForm.class);
        return VOUtil.setJsonpResult(brokerT2.funcViewpointListByDav(form), jsonpcallback);
    }

    /**
     * 大V观点信息列表
     * */
    @ResponseBody
    @RequestMapping("/func_viewpoint_detail_list_by_dav")
    @SaveLog(remark = "大V观点信息列表")
    public ViewpointDetailDavList funcBrokerViewpointDetailList(HttpServletRequest request, String jsonpcallback) {
        ViewpointDetailListForm form = getSingleParameterMapForBody(request, ViewpointDetailListForm.class);
        return VOUtil.setJsonpResult(brokerT2.funcBrokerViewpointDetailList(form), jsonpcallback);
    }

    /**
     * 获取租户观点公开配置
     * */
    @ResponseBody
    @RequestMapping("/func_viewpoint_public_get")
    @SaveLog(remark = "获取租户观点公开配置")
    public ViewpointPublicData funcViewpointPublicGet(HttpServletRequest request, String jsonpcallback) {
        HSBCPSVO form = getSingleParameterMapForBody(request, ViewpointListForm.class);
        return VOUtil.setJsonpResult(brokerT2.funcViewpointPublicGet(form), jsonpcallback);
    }

    /**
     * 大V查询观点内容
     * */
    @ResponseBody
    @RequestMapping("/func_viewpoint_content_by_broker")
    @SaveLog(remark = "大V查询观点内容")
    public ViewpointContent funcViewpointContent(HttpServletRequest request, String jsonpcallback) {
        ViewPointIdForm form = getSingleParameterMapForBody(request, ViewPointIdForm.class);
        return VOUtil.setJsonpResult(brokerT2.funcViewpointContent(form), jsonpcallback);
    }
    
    /**
     * 大V观点信息保存
     * */
    @ResponseBody
    @RequestMapping("/func_broker_viewpoint_save")
    @SaveLog(remark = "大V观点信息保存")
    public HSBCPSBackVO brokerViewpointSave(HttpServletRequest request, String jsonpcallback) {
         ViewpointSaveForm form = getSingleParameterMapForBody(request, ViewpointSaveForm.class);
        return VOUtil.setJsonpResult(brokerT2.brokerViewpointSave(form), jsonpcallback);
    }
    
    /**
     * 大V观点信息删除
     * */
    @ResponseBody
    @RequestMapping("/func_broker_viewpoint_del")
    @SaveLog(remark = "大V观点信息删除")
    public HSBCPSBackVO brokerViewpointDel(HttpServletRequest request, String jsonpcallback) {
        ViewPointIdForm form = getSingleParameterMapForBody(request, ViewPointIdForm.class);
        return VOUtil.setJsonpResult(brokerT2.brokerViewpointDel(form), jsonpcallback);
    }
    
    /**
     * 大V观点清空
     * */
    @ResponseBody
    @RequestMapping("/func_broker_viewpoint_clear")
    @SaveLog(remark = "大V观点清空")
    public HSBCPSBackVO brokerViewpointClear(HttpServletRequest request, String jsonpcallback) {
        HSBCPSVO form = getSingleParameterMapForBody(request, HSBCPSVO.class);
        return VOUtil.setJsonpResult(brokerT2.brokerViewpointClear(form), jsonpcallback);
    }
    
    /**
     * 观点评论查询
     * */
    @ResponseBody
    @RequestMapping("/func_viewpoint_comment_list")
    @SaveLog(remark = "观点评论查询")
    public ViewpointCommentDavResult viewpointCommentList(HttpServletRequest request, String jsonpcallback) {
        ViewpointCommentForm form = getSingleParameterMapForBody(request, ViewpointCommentForm.class);
        return VOUtil.setJsonpResult(brokerT2.viewpointCommentList(form), jsonpcallback);
    }
    
    /**
     * 大V观点评论回复
     * */
    @ResponseBody
    @RequestMapping("/func_comment_replay_save")
    @SaveLog(remark = "大V观点评论回复")
    public CommentSaveResult commentReplaySave(HttpServletRequest request, String jsonpcallback) {
        CommentReplayForm form = getSingleParameterMapForBody(request, CommentReplayForm.class);
        return VOUtil.setJsonpResult(brokerT2.commentReplaySave(form), jsonpcallback);
    }
    
    /**
     * 评论
     * */
    @ResponseBody
    @RequestMapping("/func_comment_save")
    @SaveLog(remark = "评论")
    public CommentSaveResult funcComment(HttpServletRequest request, String jsonpcallback) {
        ViewpointCommentSaveForm form = getSingleParameterMapForBody(request, ViewpointCommentSaveForm.class);
        return VOUtil.setJsonpResult(viewpointT2.funcCommentSave(form), jsonpcallback);
    }
    
    /**
     * 大V观点评论删除
     * */
    @ResponseBody
    @RequestMapping("/func_viewpoint_comment_del")
    @SaveLog(remark = "大V观点评论删除")
    public CommentSaveResult viewpointCommentDel(HttpServletRequest request, String jsonpcallback) {
        CommentReplayIdForm form = getSingleParameterMapForBody(request, CommentReplayIdForm.class);
        return VOUtil.setJsonpResult(brokerT2.viewpointCommentDel(form), jsonpcallback);
    }
    
    /**
     * 大V增加观点标签
     * */
    @ResponseBody
    @RequestMapping("/func_viewpoint_tag_save")
    @SaveLog(remark = "大V增加观点标签")
    public HSBCPSBackVO saveNewTag(HttpServletRequest request, String jsonpcallback) {
        ViewpointTagForm form = getSingleParameterMapForBody(request, ViewpointTagForm.class);
        return VOUtil.setJsonpResult(brokerT2.saveNewTag(form), jsonpcallback);
    }
    
    /**
     * 删除大V标签
     * */
    @ResponseBody
    @RequestMapping("/func_viewpoint_tag_del")
    @SaveLog(remark = "删除大V标签")
    public HSBCPSBackVO brokerTagDel(HttpServletRequest request, String jsonpcallback) {
        ViewpointTagIdForm form = getSingleParameterMapForBody(request, ViewpointTagIdForm.class);
        return VOUtil.setJsonpResult(brokerT2.brokerTagDel(form), jsonpcallback);
    }
    
    /**
     * 查询大V标签
     * */
    @ResponseBody
    @RequestMapping("/func_viewpoint_tag_list")
    @SaveLog(remark = "查询大V标签")
    public ViewpointTagListResult brokerTagList(HttpServletRequest request, String jsonpcallback) {
        HSBCPSVO form = getSingleParameterMapForBody(request, HSBCPSVO.class);
        return VOUtil.setJsonpResult(brokerT2.brokerTagList(form), jsonpcallback);
    }
    
    @ResponseBody
    @RequestMapping("/func_viewpoint_tag_update")
    @SaveLog(remark = "修改大V标签")
    public HSBCPSBackVO updateNewTag(HttpServletRequest request, String jsonpcallback) {
        ViewpointTagUpdateForm form = getSingleParameterMapForBody(request, ViewpointTagUpdateForm.class);
        return VOUtil.setJsonpResult(brokerT2.updateNewTag(form), jsonpcallback);
    }
    
    @ResponseBody
    @RequestMapping("/func_viewpoint_tag_sort")
    @SaveLog(remark = "排序大V标签")
    public HSBCPSBackVO sortNewTag(HttpServletRequest request, String jsonpcallback) {
        ViewpointTagSortForm form = getSingleParameterMapForBody(request, ViewpointTagSortForm.class);
        return VOUtil.setJsonpResult(brokerT2.sortNewTag(form), jsonpcallback);
    }
    
    @ResponseBody
    @RequestMapping("/func_viewpoint_replay_detail_list")
    @SaveLog(remark = "查看引用详细")
    public ReplyListData funcViewpointReplayDetailList(HttpServletRequest request, String jsonpcallback) {
        ReplyListForm form = getSingleParameterMapForBody(request, ReplyListForm.class);
        return VOUtil.setJsonpResult(viewpointT2.funcViewpointReplayDetailList(form), jsonpcallback);
    }
    
    /**
     * 常用语查询
     */
    @ResponseBody
    @RequestMapping("/func_common_reply_list")
    @SaveLog(remark = "常用语查询")
    public CommonReplyList funcCommonReplyList(HttpServletRequest request, String jsonpcallback) {
        HSBCPSVO form = getSingleParameterMapForBody(request, HSBCPSVO.class);
        return VOUtil.setJsonpResult(commonT2.funcCommonReplyList(form), jsonpcallback);
    }
    
    /**
     * 常用语保存
     */
    @ResponseBody
    @RequestMapping("/func_common_reply_save")
    @SaveLog(remark = "常用语保存")
    public HSBCPSBackVO funcCommonReplySave(HttpServletRequest request, String jsonpcallback) {
        CommonReplySaveForm form = getSingleParameterMapForBody(request, CommonReplySaveForm.class);
        return VOUtil.setJsonpResult(commonT2.funcCommonReplySave(form), jsonpcallback);
    }
    
    /**
     * 常用语删除
     */
    @ResponseBody
    @RequestMapping("/func_common_reply_del")
    @SaveLog(remark = "常用语删除")
    public HSBCPSBackVO funcCommonReplyDel(HttpServletRequest request, String jsonpcallback) {
        CommonReplyIdForm form = getSingleParameterMapForBody(request, CommonReplyIdForm.class);
        return VOUtil.setJsonpResult(commonT2.funcCommonReplyDel(form), jsonpcallback);
    }
    
    @ResponseBody
    @RequestMapping("/func_viewpoint_top")
    @SaveLog(remark = "大V观点置顶")
    public HSBCPSBackVO funcViewpointTop(HttpServletRequest request, String jsonpcallback) {
        ViewPointTopForm form = getSingleParameterMapForBody(request, ViewPointTopForm.class);
        return VOUtil.setJsonpResult(brokerT2.funcViewpointTop(form), jsonpcallback);
    }
    
    @ResponseBody
    @RequestMapping("/func_comment_view_by_broker")
    @SaveLog(remark = "大V查看观点评论详情")
    public ViewpointCommentResult funcCommentViewByBroker(HttpServletRequest request, String jsonpcallback) {
        ViewpointCommentForm form = getSingleParameterMapForBody(request, ViewpointCommentForm.class);
        return VOUtil.setJsonpResult(viewpointT2.funcCommentViewByBroker(form), jsonpcallback);
    }
    
    @ResponseBody
    @RequestMapping("/func_viewpoint_content_convert")
    @SaveLog(remark = "观点格式转换")
    public HSBCPSBackVO funcViewpointContentConvert(HttpServletRequest request, String jsonpcallback) {
        HSBCPSVO form = getSingleParameterMapForBody(request, HSBCPSVO.class);
        return VOUtil.setJsonpResult(viewpointT2.funcViewpointContentConvert(form), jsonpcallback);
    }
    
}
